#pragma once
#include "test_base.h"
#include "lockfreelist.h"
#include <random>
#include <functional>

class linklist_test : public test_base
{
public:
	linklist_test(long loops, bool force_context_switch) :test_base(loops, force_context_switch),
							_input_gen(std::bind(std::uniform_int_distribution<int>(0, loops), std::mt19937()))
	{}

	virtual ~linklist_test(){}

	virtual std::string test_name(void) override;

protected:
	virtual void test_init() override;
	virtual void do_test() override;

private:
	std::function<int()>									_input_gen;
	static __declspec(thread) int							_random_toll;
	std::unique_ptr<LockFreeList<int>>						_list;
	static __declspec(thread) LockFreeList<int>::iterator*	_it;
};

